$(document).ready(function() {
	
class_change_fn = function() {
	$('#FIELDLIST').empty();
	$('#CHAR_UNIQ_FIELD_LIST li').each(function(index) {
		if ($('#CLASSLIST').val() == $(this).attr('flexyclass_id')) {
			$('#FIELDLIST').append('<option value="' + $(this).attr('field_id') + '">' + $(this).html() +'</option>');
		}
	});
};
		
$('#FIELDTYPE').change(function() {
	if ($(this).val() == "NTO1" || $(this).val() == "NTOM") {
		$('#CLASSLISTROW').attr('class', 'unhidden');
		$('#FIELDLISTROW').attr('class', 'unhidden');
		class_change_fn();
	} else {
		$('#CLASSLISTROW').attr('class', 'hidden');
		$('#FIELDLISTROW').attr('class', 'hidden');
	}
});

$('#CLASSLIST').change(class_change_fn);

}); //document ready
